/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.classnet.db;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 *
 * @author karltinawi
 */
@Embeddable
public class CoursePK implements Serializable {
    @Column(name = "subject", nullable = false)
    private String subject;
    @Column(name = "code", nullable = false)
    private String code;
    @Column(name = "section", nullable = false)
    private String section;

    public CoursePK() {
    }

    public CoursePK(String subject, String code, String section) {
        this.subject = subject;
        this.code = code;
        this.section = section;
    }

    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getSection() {
        return section;
    }

    public void setSection(String section) {
        this.section = section;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (subject != null ? subject.hashCode() : 0);
        hash += (code != null ? code.hashCode() : 0);
        hash += (section != null ? section.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CoursePK)) {
            return false;
        }
        CoursePK other = (CoursePK) object;
        if ((this.subject == null && other.subject != null) || (this.subject != null && !this.subject.equals(other.subject))) {
            return false;
        }
        if ((this.code == null && other.code != null) || (this.code != null && !this.code.equals(other.code))) {
            return false;
        }
        if ((this.section == null && other.section != null) || (this.section != null && !this.section.equals(other.section))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.classnet.db.CoursePK[subject=" + subject + ", code=" + code + ", section=" + section + "]";
    }

}
